var util = {
  // 时间戳转换时间
  formatDate (time) {
    var now = new Date(time)
    var year = now.getFullYear()
    var month = now.getMonth() + 1
    var date = now.getDate()
    var hour = now.getHours() >= 10 ? now.getHours() : ('0' + now.getHours())
    var minute = now.getMinutes() >= 10 ? now.getMinutes() : ('0' + now.getMinutes())
    var second = now.getSeconds() >= 10 ? now.getSeconds() : ('0' + now.getSeconds())
    return year + '-' + month + '-' + date + '  ' + hour + ':' + minute + ':' + second
  },
  // 判断两个数组是否相等
  equar (a, b) {
    // 判断数组的长度
    if (a.length !== b.length) {
      return false
    } else {
      // 循环遍历数组的值进行比较
      for (let i = 0; i < a.length; i++) {
        if (a[i] !== b[i]) {
          return false
        }
      }
      return true
    }
  },
  // 测试
  a () {
    console.log('a', this.formatDate(1545617333))
  }
}

export default util
